import request from '@/utils/request';
// request.defaults.baseURL = 'https://console-mock.apipost.cn/app/mock/project/79ea3b05-05f2-4f42-b40d-3d7f56281f27'

/**
 * 获取基本素材库的东西
 * @param data
 *
 * @returns
 */
export const getBaseMaterial = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/getLists',
        method: 'get',
        params: data
    });
};

// 店铺列表-筛选框使用 默认 get请求 兼容以前接口
export const getMaterialStoreList = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/store-list',
        method: 'get',
        params: data
    });
};

// 店铺列表-筛选框使用 post 请求
export const getMaterialStoreListPost = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/store-list',
        method: 'post',
        data
    });
};

// 获取商品素材列表
export const getGoodsList = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/product/list',
        method: 'post',
        data
    });
};

// 获取页面素材列表
export const getPageList = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/page/list',
        method: 'post',
        data
    });
};

// 上传多媒体文件
export const uploadBaseMaterial = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/create',
        method: 'post',
        data
    });
};
// 营销工具 获取分组
export function getGroupMarket(data: any) {
    return request({
        url: '/scrm-api/console/tenant/group/list-for-market',
        method: 'post',
        data
    });
}

// ++++++++++++++++++++++++++++++++++ 图片   +++++++++++++++++++++++++++++++++
// 获取图片列表
export function getImageList(data: any) {
    return request({
        url: '/scrm-api/console/media/content/image/list',
        method: 'post',
        data
    });
}

// 获取图片列表
export function getImageList1(data: any) {
    return request({
        url: '/scrm-api/console/media/content/image/list',
        method: 'post',
        data,
        noNeedLoading: true
    });
}
// 图片信息
export function imagesInfo(data: any) {
    return request({
        url: '/scrm-api/console/media/content/image/info',
        method: 'get',
        params: data
    });
}
// 上传图片
export const uploadImage = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/image/create',
        method: 'post',
        data
    });
};
// 修改图片
export function modifyImage(data: any) {
    return request({
        url: '/scrm-api/console/media/content/image/update',
        method: 'post',
        data
    });
}
// 删除图片
export function delImage(data: any) {
    return request({
        url: '/scrm-api/console/media/content/image/del',
        method: 'post',
        data
    });
}
// 删除图片
export function delImage1(data: any) {
    return request({
        url: '/scrm-api/console/media/content/image/del',
        method: 'post',
        data,
        noNeedLoading: true
    });
}
// ++++++++++++++++++++++++++++++++++ 音频   +++++++++++++++++++++++++++++++++
// 获取音频列表
export const getVoiceList = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/audio/list',
        method: 'post',
        data
    });
};
// 获取音频详情
export const getVoiceInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/audio/info',
        method: 'get',
        params: data
    });
};
// 创建音频
export const uplodVoice = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/audio/create',
        method: 'post',
        data
    });
};
// 修改音频
export const changeVoice = (data: any) => {
    return request({
        url: 'scrm-api/console/media/content/audio/update',
        method: 'post',
        data
    });
};
//获取多媒体内容详情
export const getBaseMaterialDetail = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/getInfo',
        method: 'get',
        params: data
    });
};
//更新多媒体内容
export const updateBaseMaterial = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/update',
        method: 'put',
        data
    });
};
//删除多媒体内容
export const removeBaseMaterial = (data: any) => {
    return request({
        url: 'scrm-api/console/media/content/destroy',
        method: 'delete',
        params: data
    });
};
// 批量删除素材库内容
export const batchContentDel = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/batch-delete',
        method: 'post',
        data,
        noNeedLoading: true
    });
};

// 获取视频详情
export const getVideoData = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/video/info',
        method: 'get',
        params: data
    });
};

// 创建视频
export const conserve = (data: any) => {
    return request({
        url: 'scrm-api/console/media/content/video/create',
        method: 'POST',
        data,
        noNeedLoading: true
    });
};

// 更新视频
export const updateVideo = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/video/update',
        method: 'post',
        data,
        noNeedLoading: true
    });
};
//++++++++++++++++++++++++++++++++++基础素材批量下载 ++++++++++++++++++++++++++++++++++++++++++++++++
// 批量下载
/**
   *  
   * @param data 
   * {
    "material_ids": [9],  素材id
    "material_type": 2 素材类型
    }
   * @returns 
   */
export const batchDownLoad = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/batch-download',
        method: 'post',
        data
    });
};
// ++++++++++++++++++++++++++++++++++++++++++分组管理++++++++++++++++++++++++++++++++++++++++++++++
// 新建分组
export const creatGroup = (data: any) => {
    return request({
        url: '/scrm-api/console/tenant/group/create',
        method: 'post',
        data,
        noNeedLoading: true
    });
};
//获取 分组详情
export const getGroupDetail = (data: any) => {
    return request({
        url: '/scrm-api/console/tenant/group/getInfo',
        method: 'get',
        params: data
    });
};
//更新 分组内容
export const updateGroup = (data: any) => {
    return request({
        url: '/scrm-api/console/tenant/group/update',
        method: 'post',
        data,
        noNeedLoading: true
    });
};
// 删除 分组
export const delGroup = (data: any) => {
    return request({
        url: '/scrm-api/console/tenant/group/destroy',
        method: 'post',
        data,
        noNeedLoading: true
    });
};
//获取 分组列表
export const getGroupList = (data: any) => {
    return request({
        url: '/scrm-api/console/tenant/group/getLists',
        method: 'get',
        params: data,
        noNeedLoading: true
    });
};
// ++++++++++++++++++++++++++++++++++ 文本   +++++++++++++++++++++++++++++++++

//获取文本 列表
export const getTextList = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/text/list',
        method: 'post',
        data,
        noNeedLoading: true
    });
};

//获取 收集表列表
export const getCollectList = (data: any) => {
    return request({
        // url: '/scrm-api/console/content/advanced/collect/list',
        url: '/scrm-api/console/media/content/collect/list',
        method: 'post',
        data
    });
};

//获取 创建文本
export const createText = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/text/create',
        method: 'post',
        data
    });
};
//修改文本
export const EidtText = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/text/update',
        method: 'post',
        data,
        noNeedLoading: true
    });
};
//获取 文本
export const textInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/text/info',
        method: 'get',
        params: data,
        noNeedLoading: data.noNeedLoading
    });
};
// 下载导入话术模板
export const downTemp = () => {
    return request({
        url: '/scrm-api/console/media/content/text/download/template',
        method: 'get'
    });
};
// 下载导入话术模板
export const importWord = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/text/import',
        type: 2,
        method: 'post',
        data,
        noNeedLoading: true
    });
};

//-----------------------------文件---------------------------------
//获取文件列表
export const getFileList = (data: any, noNeedLoading = false) => {
    return request({
        url: '/scrm-api/console/media/content/file/list',
        method: 'post',
        data: data,
        noNeedLoading
    });
};

//文件详情
export const getFileInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/file/info',
        method: 'get',
        params: data
    });
};

//修改文件
export const updateFile = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/file/update',
        method: 'post',
        data: data,
        noNeedLoading: true
    });
};

//创建文件接口
export const createdFile = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/file/create',
        method: 'post',
        data: data,
        noNeedLoading: true
    });
};

//文件删除
export const delFile = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/file/del',
        method: 'post',
        data: data
    });
};
//-------------------------链接--------------------
//链接列表
export const linkList = (data: any, noNeedLoading = false) => {
    return request({
        url: '/scrm-api/console/media/content/link/list',
        method: 'post',
        data: data,
        noNeedLoading
    });
};

//创建链接
export const createLink = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/link/create',
        method: 'post',
        data: data
    });
};

//快速创建链接
export const quickLink = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/link/quick-create',
        method: 'post',
        data: data,
        noNeedLoading: true
    });
};

//连接详情
export const linkInfos = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/link/info',
        method: 'get',
        params: data
    });
};

//修改链接
export const updateLink = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/link/update',
        method: 'post',
        data: data
    });
};
// +++++++++++++++++++++++++++++++++++++++++朋友圈素材++++++++++++++++++++++++++++++++++++++++++++++
// 朋友圈列表
export const friendList = (data: any) => {
    return request({
        url: '/scrm-api/console/media/moment/getList',
        method: 'POST',
        data,
        noNeedLoading: true
    });
};
// 朋友圈删除
export const friendDel = (data: any) => {
    return request({
        url: '/scrm-api/console/media/moment/destroy',
        method: 'get',
        params: data,
        noNeedLoading: true
    });
};
// 朋友圈详情
export const friendDetail = (data: any) => {
    return request({
        url: '/scrm-api/console/media/moment/getInfo',
        method: 'get',
        params: data
    });
};
// 创建朋友圈接口
export const createFriend = (data: any) => {
    return request({
        url: '/scrm-api/console/media/moment/create',
        method: 'post',
        data
    });
};
// 编辑朋友圈接口
export const editFriend = (data: any) => {
    return request({
        url: '/scrm-api/console/media/moment/update',
        method: 'post',
        data
    });
};
